export default function escape2html() {
  function toHtml(str: string) {
    if (str == undefined) return ''
    var arrEntities: any = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'amp;quot': '"', 'quot': '"' };
    let ans = str.replace(/&(lt|gt|nbsp|amp;quot|quot|amp);/ig, function (all, t: any) {
      return arrEntities[t];
    });
    ans = "&emsp;&emsp;" + ans.replaceAll(/(?<=font-family:[^;]*)"(.*?)"(?=;)/g, '\'$1\'')
    return ans;
  }


  return {
    toHtml
  }
}